#sing @echo off & SetLocal EnableDelayedExpansion
#newl#sing set max=512|#newl#sing set max=480|--Max width. There is no space at the end.--
#newl cd /d "#ppthapps\mencoder"
#newl FOR /F "tokens=1,2 delims==" %%G IN ('mplayer.exe -identify -frames 0 -vo null -ao null  "#item" ') DO (  set %%G=%%H)
#newl set /a newheight=(!max!*!ID_VIDEO_HEIGHT!)/!ID_VIDEO_WIDTH!
#newl set /a checkeven=!newheight!/2*2 & if not !checkeven!==!newheight! set /a newheight=!newheight!+1 
#newl set resizeline=-s !max!:!newheight!
#newl echo old size="!ID_VIDEO_WIDTH!:!ID_VIDEO_HEIGHT!" new size="!max!:!newheight!" & echo *** resizeline="!resizeline!"
#newl "#ppthapps\ffmpeg\ffmpeg.exe" |-program file-
-i "#item" |-i "#item" -i "#path#name.mp2" |-i "#item" -i "#path#name.mp3" |-i "#item" -i "#path#name.aac" |-i "#item" -i "#path#name.wav" |-i "#item" -i "#path#name.mpa" |-i "#item" -r 1 -loop_input -i "d:\picture.jpg" -shortest |-input, or encode with alternate audio source file-
-vcodec mpeg4 |-vcodec libxvid |-vcodec copy |-vn |-vcodec libx264 |-vcodec-
-q:v 3.3 |-b 1000k |-fpre "#ppthapps\ffmpeg\presets\libx264-slow.ffpreset" -crf 22 |-fpre "#ppthapps\ffmpeg\presets\libx264-slow.ffpreset" -b 500k |--fpresets are for x264 only, "-b 500k " or "-crf 22" can be used with it.--
-vtag XVID |-vtag DIVX |-vtag H264 |-vtag AVC1 |-Video tag-
-threads 2 |-threads 0 |-threads 1 |-cpu threads. zero means auto (when supported, like x264)-
#remark -scaling_type-|-sws_flags fast_bilinear |-scaling type-
-acodec mp2 |-acodec libmp3lame |-acodec copy |-acodec pcm_s16le |-acodec aac -strict experimental |-acodec libvorbis |-an |--Acodec. Use mkv or mp4 as output when using aac.--
-ab 128k |-ab 96k |-ab 160k |-ab 192k |-ab 64k |-aq 6 |-aq 5 |--acodec bitrate. Vorbis: aq5= ~128, aq6= ~224--
#remark -channels-|-ac 1 |-ac 2 |-channels-
#remark -resample_audio-|-ar 22050 |-ar 44100 |-ar 48000 |--resample audio--
!resizeline! |-s 512x384 |-s 512x288 |-s 480x270 |-s 320x240 |-s 640x480 |-resize-
#remark -aspect_ratio-|-aspect 16:9 |-aspect 16:10 |-aspect 4:3 |--aspect ratio--
#remark -start_time-|-ss 00:02:40 |-Start time. Optional. HH:MM:SS-
#remark -end_time-|-t 10 |-t 5 |-vframes 250 |-endtime-
#remark -overwrite_file-|-y |-overwrite existing file-
#remark -output_fps-|-r 24 |-r 23.97 |-r 25 |-r 29.97 |-r 30 |-r 24000/1001 |--output fps--
#remark -crop- | -vf crop=1000:768:00:0 | --crop image--
"#path#name-ffm.avi" |"#path#name-ffm.mkv" |"#path#name-ffm.mp4" |-output-

<comment>
Create divx movie using ffmpeg. Auto calculate height.
!resizeline! means use calculated height value from the "set max=512" width.
To speed up encoding select line "-sws_flags fast_bilinear ", (below "-threads 2 )
Does not work with rmvb files. Auto calc of height is not always perfect.
Slower than mencoder.
You should use HandbrakeCLI for h264.


if 13/2*2=12, 6*2, not 6.5*2, add 1
(if not even number, add, 1)


1024:768:0:0, 
shorten image by 24 pixels, (remove 24 pixels from the right): 
-vf crop=1000:768:00:0 
or,
shorten image by 24 pixels, (remove 24 pixels from the right), and move cropping rectanle to the right (on x axis)
by 24 pixels:
-vf crop=1000:768:24:0 